﻿#ifndef NETWORKSTATIONIDENT_H
#define NETWORKSTATIONIDENT_H
#include <string>
#include <vector>
using namespace std;


struct NetWorkStation{
    char station[16];//网台类型
    double freq; //频率
    double modRate; //调制速率
    char modType[16]; //调制方式
    char codeType[16]; //编码方式
    NetWorkStation(){
        memset(this,0,sizeof (NetWorkStation));
    }
    void setSation(string str){
        memset(station,0,sizeof (station));
        memcpy(station,str.c_str(),str.length() >= 16 ? 15 : str.length());
    }
    void setModType(string str){
        memset(modType,0,sizeof (modType));
        memcpy(modType,str.c_str(),str.length() >= 16 ? 15 : str.length());
    }
    void setCodeType(string str){
        memset(codeType,0,sizeof (codeType));
        memcpy(codeType,str.c_str(),str.length() >= 16 ? 15 : str.length());
    }
};

class NetWorkStationIdent
{
public:
    NetWorkStationIdent(string filePath);
    ~NetWorkStationIdent();
    //维护使用接口
    vector<NetWorkStation> getStations() const;
    void setStations(const vector<NetWorkStation> &value);
    bool saveToFile(string filePath);
    //调用使用接口
    bool identify(string &stationType,double freq,double modRate,string modType,string modCode);
private:
    vector<NetWorkStation> stations;
};

#endif // NETWORKSTATIONIDENT_H
